package lily.phs.object;

import android.R.integer;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import lily.phs.database.Constants;

public class HealthEdu implements Constants
{
	private Context myContext;
	
	public int _ID=-1;	
	private String here_time="";
	private String here_place="";
	private String here_form="";
	private String here_theme="";
	private String here_organizer="";
	private String here_sort="";
	private int here_acc_num=-1;
	private String here_kind_num="";
	private String here_content="";
	private String here_evaluate="";
	private String here_person_sign="";
	private String here_charge_sign="";
	private String here_filltime="";
	private String here_material="";
	
	public HealthEdu (Context context)
	{
		this.myContext=context;
	}
	
	public int get_Id() {
		return _ID;
	}

	public void set_Id(int here_id) {
		this._ID = here_id;
	}

	public String getHere_time() {
		return here_time;
	}

	public void setHere_time(String here_time) {
		this.here_time = here_time;
	}

	public String getHere_place() {
		return here_place;
	}

	public void setHere_place(String here_place) {
		this.here_place = here_place;
	}

	public String getHere_form() {
		return here_form;
	}

	public void setHere_form(String here_form) {
		this.here_form = here_form;
	}

	public String getHere_theme() {
		return here_theme;
	}

	public void setHere_theme(String here_theme) {
		this.here_theme = here_theme;
	}

	public String getHere_organizer() {
		return here_organizer;
	}

	public void setHere_organizer(String here_organizer) {
		this.here_organizer = here_organizer;
	}

	public String getHere_sort() {
		return here_sort;
	}

	public void setHere_sort(String here_sort) {
		this.here_sort = here_sort;
	}

	public int getHere_acc_num() {
		return here_acc_num;
	}

	public void setHere_acc_num(int here_acc_num) {
		this.here_acc_num = here_acc_num;
	}

	public String getHere_kind_num() {
		return here_kind_num;
	}

	public void setHere_kind_num(String here_kind_num) {
		this.here_kind_num = here_kind_num;
	}

	public String getHere_content() {
		return here_content;
	}

	public void setHere_content(String here_content) {
		this.here_content = here_content;
	}

	public String getHere_evaluate() {
		return here_evaluate;
	}

	public void setHere_evaluate(String here_evaluate) {
		this.here_evaluate = here_evaluate;
	}

	public String getHere_person_sign() {
		return here_person_sign;
	}

	public void setHere_person_sign(String here_person_sign) {
		this.here_person_sign = here_person_sign;
	}

	public String getHere_charge_sign() {
		return here_charge_sign;
	}

	public void setHere_charge_sign(String here_charge_sign) {
		this.here_charge_sign = here_charge_sign;
	}

	public String getHere_filltime() {
		return here_filltime;
	}

	public void setHere_filltime(String here_filltime) {
		this.here_filltime = here_filltime;
	}

	public String getHere_material() {
		return here_material;
	}

	public void setHere_material(String here_material) {
		this.here_material = here_material;
	}
	
	public void insertHealthEdu()
	{
		ContentValues value=new ContentValues();
		value.put(HERE_ACC_NUM,this.getHere_acc_num());
		value.put(HERE_CHARGE_SIGN, this.getHere_charge_sign());
		value.put(HERE_CONTENT, this.getHere_content());
		value.put(HERE_EVALUATE, this.getHere_evaluate());
		value.put(HERE_FILLTIME, this.getHere_filltime());
		value.put(HERE_FORM, this.getHere_form());
		value.put(HERE_KIND_NUM, this.getHere_kind_num());
		value.put(HERE_ORGANIZER,this.getHere_organizer());
		value.put(HERE_PERSON_SIGN, this.getHere_person_sign());
		value.put(HERE_PLACE, this.getHere_place());
		value.put(HERE_SORT, this.getHere_sort());
		value.put(HERE_THEME, this.getHere_theme());
		value.put(HERE_TIME, this.getHere_time());
		value.put(HERE_MATERIAL, this.getHere_material());
		//value.put(_ID, this.get_ID());
		myContext.getContentResolver().insert(CONTENT_URI_TB25, value);
	}
	
	public void selectHealthEdu(int _Id)
	{
		String where = _ID + "=" + _Id;
		Cursor cursor = myContext.getContentResolver().query(CONTENT_URI_TB25, null, where, null, null);
		System.out.println("edu:cursor.getCount()="+cursor.getCount());
		while(cursor.moveToNext())
		{
			this.here_acc_num=cursor.getInt(cursor.getColumnIndex(HERE_ACC_NUM));
			this.here_charge_sign=cursor.getString(cursor.getColumnIndex(HERE_CHARGE_SIGN));
			this.here_content=cursor.getString(cursor.getColumnIndex(HERE_CONTENT));
			this.here_evaluate=cursor.getString(cursor.getColumnIndex(HERE_EVALUATE));
			this.here_filltime=cursor.getString(cursor.getColumnIndex(HERE_FILLTIME));
			this.here_form=cursor.getString(cursor.getColumnIndex(HERE_FORM));
			//this.here_id=cursor.getInt(cursor.getColumnIndex(HERE_ID));
			this.here_kind_num=cursor.getString(cursor.getColumnIndex(HERE_KIND_NUM));
			this.here_material=cursor.getString(cursor.getColumnIndex(HERE_MATERIAL));
			this.here_organizer=cursor.getString(cursor.getColumnIndex(HERE_ORGANIZER));
			this.here_person_sign=cursor.getString(cursor.getColumnIndex(HERE_PERSON_SIGN));
			this.here_place=cursor.getString(cursor.getColumnIndex(HERE_PLACE));
			this.here_sort=cursor.getString(cursor.getColumnIndex(HERE_SORT));
			this.here_theme=cursor.getString(cursor.getColumnIndex(HERE_THEME));
			this.here_time=cursor.getString(cursor.getColumnIndex(HERE_TIME));
		}
		cursor.close();
	}
	
	public void updateHealthEdu(int _Id)
	{
		ContentValues value=new ContentValues();
		
		value.put(HERE_ACC_NUM,this.getHere_acc_num());
		value.put(HERE_CHARGE_SIGN, this.getHere_charge_sign());
		value.put(HERE_CONTENT, this.getHere_content());
		value.put(HERE_EVALUATE, this.getHere_evaluate());
		value.put(HERE_FILLTIME, this.getHere_filltime());
		value.put(HERE_FORM, this.getHere_form());
		value.put(HERE_KIND_NUM, this.getHere_kind_num());
		value.put(HERE_ORGANIZER,this.getHere_organizer());
		value.put(HERE_PERSON_SIGN, this.getHere_person_sign());
		value.put(HERE_PLACE, this.getHere_place());
		value.put(HERE_SORT, this.getHere_sort());
		value.put(HERE_THEME, this.getHere_theme());
		value.put(HERE_TIME, this.getHere_time());
		value.put(HERE_MATERIAL, this.getHere_material());
		//value.put(HERE_ID, this.getHere_id());

		String where = _ID + "=" + _Id;
		myContext.getContentResolver().update(CONTENT_URI_TB25, value,where,null);
	}
	
	public void delectHealthEdu(int _Id)
	{
		String where = _ID + "=" + _Id;
		myContext.getContentResolver().delete(CONTENT_URI_TB25, where, null);
	}
}
